//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace Eas.WebCrawler.Test.Scenario {
    public class UriProcessedCheckAction : NMock2.IAction {
        Dictionary<Uri, object> _Dictionary;
        public UriProcessedCheckAction(Dictionary<Uri, object> dictionary) {
            _Dictionary = dictionary;
        }

        #region IInvokable Members

        public void Invoke(NMock2.Monitoring.Invocation invocation) {
            Eas.WebCrawler.Interfaces.UrlCompletedEventArgs args = (Eas.WebCrawler.Interfaces.UrlCompletedEventArgs)invocation.Parameters[1];
            System.Diagnostics.Debug.Assert(_Dictionary.ContainsKey(args.State.Request.Uri));
            _Dictionary.Remove(args.State.Request.Uri);
        }

        #endregion

        #region ISelfDescribing Members

        public void DescribeTo(System.IO.TextWriter writer) {
            writer.Write(" UrlProcessedChaeckAction ");
        }

        #endregion
    }
}
